package com.zeldu.teacher.homework.test;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sun.prism.shader.Solid_TextureYV12_AlphaTest_Loader;
import com.zeldu.common.util.PhoneUtil;
import com.zeldu.teacher.homework.Dto.HomeWrokDetailDto;
import com.zeldu.teacher.homework.Dto.HomeWrok_SutdentDto;
import com.zeldu.teacher.homework.entity.Question;
import com.zeldu.teacher.homework.entity.Student_HomeWrok;
import com.zeldu.teacher.homework.mapper.QuestionMapper;
import com.zeldu.teacher.homework.mapper.Student_HomeWrokMapper;
import javafx.scene.input.InputMethodTextRun;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestComponent;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.ArrayList;
import java.util.List;

@RunWith(SpringRunner.class)
@SpringBootTest
public class mytest {
@Autowired
    Student_HomeWrokMapper student_homeWrokMapper;
@Autowired
    QuestionMapper questionMapper;
@Test
public void  test(){
//    final Student_HomeWrok byId = student_homeWrokMapper.findById(1286977770684948488l);
//    System.out.println(byId);
     List<Student_HomeWrok> homeWrokBySid = student_homeWrokMapper.findHomeWrokBySid(1286977770684948477l);

    for (Student_HomeWrok student_homeWrok : homeWrokBySid) {
        System.out.println(student_homeWrok);
    }
}

@Test
    public  void test1(){
     String detailHw = student_homeWrokMapper.findDetailHw(1286977770684948481l, 1286977770684948477l);
     List<HomeWrokDetailDto> homeWrokDetailDtos = JSON.parseArray(detailHw, HomeWrokDetailDto.class);
    System.out.println(homeWrokDetailDtos);
}

    @Test
    public  void test2(){
        List<Long> ids=new ArrayList<>();
        ids.add(1288012149356023853l);
        ids.add(1288012149356023854l);
        Long tid=1286977770684948448l;
//        List<Question> questions = questionMapper.selectList(new LambdaQueryWrapper<Question>().in(Question::getId, ids).eq(Question::getTeacherId, tid));
        final List<Question> exQuestions = questionMapper.findExQuestions(ids,tid);
        System.out.println(exQuestions);
}

@Test
    public  void test4(){
    List<HomeWrok_SutdentDto> list =new ArrayList<>();
    HomeWrok_SutdentDto h=new HomeWrok_SutdentDto();
    h.setEndTime(null);
    h.setStartTime(null);
    h.setHomeworkId(1l);
    h.setHomeworkContent("t");
    h.setHomeworkName("t");
    h.setSutdentId(1l);
    h.setScore(null);
    h.setStatus(0);
    h.setId(1l);
    list.add(h);


    HomeWrok_SutdentDto h1=new HomeWrok_SutdentDto();
    h1.setEndTime(null);
    h1.setStartTime(null);
    h1.setHomeworkId(1l);
    h1.setHomeworkContent("t");
    h1.setHomeworkName("t");
    h1.setSutdentId(1l);
    h1.setScore(null);
    h1.setStatus(0);
    h1.setId(2l);
    list.add(h1);

    student_homeWrokMapper.insertPatchTo(list);
}


    @Test
    public  void test5(){
        List<Student_HomeWrok> list =new ArrayList<>();
        Student_HomeWrok h=new Student_HomeWrok();
        h.setEndTime(null);
        h.setStartTime(null);
        h.setHomeworkId(1l);
        h.setHomeworkContent("t");
        h.setHomeworkName("t");
        h.setSutdentId(1l);
        h.setScore(null);
        h.setStatus(0);
        h.setId(null);
        list.add(h);


        Student_HomeWrok h1=new Student_HomeWrok();
        h1.setEndTime(null);
        h1.setStartTime(null);
        h1.setHomeworkId(1l);
        h1.setHomeworkContent("t");
        h1.setHomeworkName("t");
        h1.setSutdentId(1l);
        h1.setScore(null);
        h1.setStatus(0);
        h1.setId(null);
        list.add(h1);

        student_homeWrokMapper.insertPatchToDO(list);
    }

    @Test
    public void test6(){

    }

}
